package com.taotao.merchant.service.impl;


import com.taotao.common.core.utils.StringUtils;
import com.taotao.common.redis.service.RedisService;
import com.taotao.merchant.constant.RedisConstant;
import com.taotao.merchant.service.TokenService;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;


import java.io.Serializable;
import java.util.UUID;
import java.util.concurrent.TimeUnit;

/**
 * @author 朝花不迟暮
 * @version 1.0
 * @date 2021/1/30 19:54
 */
@Service
public class TokenServiceImpl implements TokenService
{
    @Resource
    private RedisTemplate<String, Serializable> redisTemplate;

    @Override
    public void save(String idempotentId) {
        redisTemplate.opsForValue().set(idempotentId, idempotentId, 10, TimeUnit.MINUTES);
    }

    @Override
    public boolean delete(String idempotentId) {
        return redisTemplate.delete(idempotentId);
    }
}
